﻿using SqlSugar;
using System;
using System.Collections.Generic;
using System.Text;

namespace Anonym.Data
{
    public class DbProvider
    {
        public SqlSugarClient GetInstance()
        {
            //创建数据库对象
            SqlSugarClient db = new SqlSugarClient(new ConnectionConfig()
            {
                //ConnectionString = "Server=1.117.110.210,1500; Database=Anonym;uid=sa;pwd=F33XlaS9;Persist Security Info=true;",//连接符字串
                ConnectionString = "Server=47.108.159.63; Database=HeDeLong;uid=sa;pwd=Yqzkj20210810;Persist Security Info=true;",//连接符字串

                DbType = DbType.SqlServer,
                IsAutoCloseConnection = true
            });

            //添加Sql打印事件，开发中可以删掉这个代码
            db.Aop.OnLogExecuting = (sql, pars) =>
            {
                Console.WriteLine(sql);
            };
            return db;
        }
    }
}
